import maya.cmds as cmds;

cmds.SelectAll();
cmds.Delete();

outerThickness = 7.5;
outerLength = 11;
innerThickness = 2.88;
stickLength = 131;
screwDiameter = 1.65;
wireThickness = 3.15;
wireHolderWidth = 20.0 + outerThickness;
wireHolderThickness = 6;
wirePlacementOffset = 1.0;#position below stick where wire hole will be

wireOffset = 10;#distance between wires

#box = cmds.polyPlane( sx=1, sy=1, w=innerThickness, h=innerThickness);
oneSide = cmds.polyCube(n='oneSide',w=outerLength, h=outerThickness,d=outerThickness);

stick = cmds.curve( p=[(0, 0, 0), (10, 0, 0),(61, 0,-5.5), (85, 3,-11), (120, 12,-32)] );
cmds.move(outerLength/2.0);
cmds.polyExtrudeFacet( 'oneSide.f[4]',  kft=False, ltz=2, inputCurve=stick,divisions=100,taper=0.3)

removeBox = cmds.polyCube(w=outerLength, h=outerThickness,d=outerThickness);
cmds.move(0,0,-outerThickness/2.0);
cmds.select(oneSide[0],removeBox[0]);
object = cmds.polyBoolOp(op=2);



innerBox = cmds.polyCube(w=outerLength, h=innerThickness,d=outerThickness);
cmds.select(object[0],innerBox[0]);
object = cmds.polyBoolOp(op=1);

screwHole = cmds.polyCylinder( sx=20, sy=15, sz=5, h=outerThickness,r=screwDiameter/2.0);
cmds.move(outerThickness/4.0,0,-outerThickness/4.0);
cmds.select(object[0],screwHole[0]);
object = cmds.polyBoolOp(op=2);
cmds.select(object);
cmds.rotate(90,0,0,r=True);

removeBox2 = cmds.polyCube(w=outerLength, h=outerThickness,d=outerThickness);
cmds.move(-outerLength/2.0,outerThickness/2.0,0);
cmds.select(object[0],removeBox2[0]);
object = cmds.polyBoolOp(op=2);

wireHolder = cmds.polyCube(n='oneSide',w=outerLength, h=wireHolderThickness,d=wireHolderWidth);
cmds.move(0,-wireHolderThickness/2.0,wireHolderWidth/2.0-outerThickness/2.0)
cmds.select(object[0],wireHolder[0]);
object = cmds.polyBoolOp(op=1);
 
wire1 = cmds.polyCylinder( sx=20, sy=15, sz=5, h=outerThickness*2.0,r=wireThickness/2.0);
wire2 = cmds.polyCylinder( sx=20, sy=15, sz=5, h=outerThickness*2.0,r=wireThickness/2.0);
 
cmds.move(0,-outerThickness/4.0,- outerThickness/2.0-wireThickness/2.0)
 
cmds.select(wire1);
cmds.rotate(0,0,90,r=True);
cmds.move(0,-wireHolderThickness/2.0,outerThickness/2.0+wireThickness/2.0 + wirePlacementOffset)
cmds.select(object[0],wire1[0]);
object = cmds.polyBoolOp(op=2);
 
cmds.select(wire2);
cmds.rotate(0,0,90,r=True);
cmds.move(0,-wireHolderThickness/2.0,outerThickness/2.0+wireThickness/2.0 + wirePlacementOffset + wireOffset)
cmds.select(object[0],wire2[0]);
object = cmds.polyBoolOp(op=2);
 
#have to rotate only object, because if you rotate all, you rotate the curve and mess things up.
cmds.rotate(90,0,0,r=True);




